package com.jzj;

import com.jzj.mapper.StudentMapping;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.io.InputStream;

public class Main {

    @Test
    public void test()  throws IOException {
        String resource="mybatis-config.xml";
        InputStream is= Resources.getResourceAsStream(resource);

        SqlSessionFactory sqlSessionFactory= new SqlSessionFactoryBuilder().build(is);

        SqlSession session= sqlSessionFactory.openSession();

        StudentMapping mapper = session.getMapper(StudentMapping.class);


        mapper.delete();
        mapper.insert();
        mapper.update();
        mapper.select();



        session.commit();


    }


}